package com.zhongen.oa.controller;

import com.alibaba.fastjson.JSONObject;
import com.zhongen.common.core.util.R;
import com.zhongen.common.log.annotation.SysLog;
import com.zhongen.common.security.annotation.Inner;
import com.zhongen.oa.service.ProcessFinishedHandlerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/processFinishedHandler")
@Tag(description = "流程结束后请求接口", name = "流程结束后请求接口")
public class ProcessFinishedListenerController {

	@Autowired
	ProcessFinishedHandlerService processFinishedHandlerService;

	@Operation(summary = "新增项目报备申请表", description = "新增项目报备申请表")
	@SysLog("新增项目报备申请表")
	@RequestMapping("/addPreReportApply")
	@Inner
	public R addPreReportApply(@RequestBody JSONObject param) {
		return R.ok(processFinishedHandlerService.saveProjectInfo(param));
	}

	@Operation(summary = "新增合同申请表", description = "新增合同申请表")
	@SysLog("新增合同申请表")
	@RequestMapping("/addContractApply")
	@Inner
	public R addContractApply(@RequestBody JSONObject param) {
		return R.ok(processFinishedHandlerService.saveProjectContract(param));
	}

	@Operation(summary = "新增请假申请表", description = "新增请假申请表")
	@SysLog("新增请假申请表")
	@RequestMapping("/addAskLeaveApply")
	@Inner
	public R addAskLeaveApply(@RequestBody JSONObject param) {
		return R.ok(processFinishedHandlerService.addAskLeaveApply(param));
	}

	@Operation(summary = "新增项目立项申请表", description = "新增项目立项申请表")
	@SysLog("新增项目立项申请表")
	@RequestMapping("/addProjectReportApply")
	@Inner
	public R addProjectReportApply(@RequestBody JSONObject param) {
		return R.ok(processFinishedHandlerService.addProjectReportApply(param));
	}

}
